home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
scope
/
176-200
/
scopedisk180
/
arexxtutorial
/
rexecute
/
rexecute.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1995-03-19
|
3KB
|
95 lines
/*---------------------------- Start REXX Source ----------------------------*/
/* ****************************/
/* * RExecute.rexx */
/* * Execute selector program */
/* * using ARexx v1.06 */
/* * by */
/* * John Dubler, */
/* * 25-NOV-89 */
/* * v 1.00 */
/* ****************************/
/* * Adapted from Dan Schenck's print spooler. Thanks, Dan! */
if ~show(L,'rexxsupport.library') then
rc = addlib('rexxsupport.library',0,-30,0)
if ~show(L,'rexxarplib.library') then
rc = addlib('rexxarplib.library',0,-30,0)
signal on BREAK_C
true = 1
false = 0
cdir = 'rad:s/Common_Apps'
name = "df0:||||"
do forever
do while(name = "df0:||||")
name = getfile(20,50,cdir,,'RExecute - Select Function')
if name = "" then call end_all()
call parse_dir
end
address command
if index(cdir,":") = 0 then file2show = pragma('D') || cdir || "/" || name
else if right(cdir,1) ~= ":" then file2show = cdir || "/" || name
else file2show = cdir || name
ADDRESS COMMAND 'execute' file2show
name = "df0:||||"
end
/* parse_dir Procedure */
/* */
/* Separate the directory portion of the file name if there is any from */
/* the file name itself. "cdir" will contain the new directory or be left */
/* untouched if there is no directory. "name" will be modified to only */
/* contain the file name itself or "df0:||||" if there is no file name. */
parse_dir: procedure expose cdir name
if length(name) = 0 then
do /* No name or directory */
name = "df0:||||"
return
end
if ~exists(name) then
do /* Bad directory/file name */
name = "df0:||||"
return
end
i_colon = lastpos(":",name)
i_slash = lastpos("/",name)
if left(statef(name),1) = "F" then
do /* This a file, not just a directory */
if i_slash > 0 then
do /* At least one subdirectory has been given */
cdir = substr(name,1,i_slash-1)
name = substr(name,i_slash+1)
return
end
if i_colon > 0 then
do /* A main directory has been given */
cdir = substr(name,1,i_colon)
name = substr(name,i_colon+1)
return
end
return
end
if i_slash > 0 then
do /* A subdirectory with no file has been given */
cdir = name
name = "df0:||||"
return
end
/* A main directory or subdirectory only has been given */
if i_colon = 0 then cdir = cdir || name
else cdir = name
name = "df0:||||"
return
BREAK_C:
call end_all()
end_all: procedure
exit
/*----------------------------- End REXX Source -----------------------------*/